This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
fix(upgrade): remove v prefix from release URLs and work around Bun.write streaming bug - #243
Merged
Merged
Conversation
…rite streaming bug Download URLs used a `v` prefix (e.g. `/download/v0.10.1/...`) but this repo's GitHub tags are un-prefixed. Additionally, `Bun.write(path, Response)` with a large streaming body silently exits the process before the download completes (Bun event-loop bug). Materialise the body via `arrayBuffer()` first so the await keeps the process alive. Fixes CLI-5F
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. Bug Fixes 🐛
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 4126 uncovered lines. Files with missing lines (71)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 68.12% 68.13% +0.01%
==========================================
Files 108 108 —
Lines 12944 12945 +1
Branches 0 0 —
==========================================
+ Hits 8818 8819 +1
- Misses 4126 4126 —
- Partials 0 0 —Generated by Codecov Action |
3 tasks
betegon
added a commit
that referenced
this pull request
Aug 20, 2026
CLI side of the simplified repository-tool contract. Pairs with getsentry/cli-init-api#243. ## What changed `list_dir` now behaves like bounded metadata discovery: - regular files include byte `size`; - it never opens or reads file contents just to build a listing; - the advisory `isBinary` sniff is removed; - it returns `truncated: true` when `maxDepth`/`maxEntries` stop traversal or a directory cannot be read. This gives the agent enough information to avoid obviously huge files without paying an extra open/read for every file. When traversal is incomplete, the agent can list a narrower path instead of assuming the result is exhaustive. ## Compatibility File size remains optional and `truncated` is additive. Older server versions ignore the extra result field; newer servers preserve it through the agent transcript. The existing read-files V2 contract is unchanged. ## Validation - Init test suite: 34 files, 517 tests - Focused filesystem tools: 21 tests - TypeScript typecheck - Full Biome lint (987 files) - `git diff --check` The full local CLI suite also ran 9,203 tests successfully; its two existing Bash-completion shell simulations fail on this local macOS shell environment and are unrelated to this diff. --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes two bugs that prevent
sentry cli upgradefrom working for curl-installed users (CLI-5F):vprefix on release URLs —getBinaryDownloadUrl()andversionExists()constructed GitHub release URLs with avprefix (e.g.,/download/v0.10.1/...), but this repo's tags are un-prefixed (0.10.1), causing HTTP 404 errors.Bun.write(path, Response)event-loop bug — Even with correct URLs,Bun.write(tempPath, response)with a large streaming HTTP response body doesn't properly keep the Bun event loop alive. The process exits mid-download with code 0 and no error output. The workaround is to materialise the body first viaawait response.arrayBuffer(), then write the buffer.Changes
src/lib/binary.tsvprefix from download URL template ingetBinaryDownloadUrl()src/lib/upgrade.tsvprefix from version-exists tag check URL inversionExists()Bun.write(tempPath, response)withresponse.arrayBuffer()+Bun.write(tempPath, body)to work around the Bun streaming bugTests — Updated URL assertions and mocks across 3 test files to match the un-prefixed tag format.
How the Bun bug was diagnosed
straceshowed the process actively receiving data from GitHub's CDN, then callingexit_group(0)mid-download. Adding debug logging confirmedBun.write(path, Response)starts but itsawaitnever resolves — the event loop drains and the process exits cleanly. A standalone repro (await Bun.write(path, await fetch(url))) hangs indefinitely, but within the CLI's async call stack, the process exits. Materialising the body first witharrayBuffer()fixes both cases.